<?php
include "include/config.php";
include "include/functions.php";

echo "<?xml version='1.0' encoding='utf-8'?>\n";
echo "<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'>\n";
echo "<channel>\n";
echo "<title>".read_option('site_name')." Video Feed</title>\n";
echo "<link>".curPageURL()."</link>\n";
echo "<description>".read_option('site_name')." Video Feed</description>\n";
//echo "<lastBuildDate>Mon, 12 Sep 2005 18:37:00 GMT</lastBuildDate>";
echo "<language>en-us</language>\n";

$res = mysql_query("SELECT * FROM `videos` ORDER BY time DESC limit 10");
while ($row = mysql_fetch_array($res)) {
    echo "<item>\n";
	echo "<title>".htmlentities($row['name'])."</title>\n";
	$link = htmlentities("http://".$_SERVER['HTTP_HOST']."/index.php?page=video_player&video_id=".$row['id']);
	echo "<link>".$link."</link>\n";
	echo "<guid>".$link."</guid>\n";
	echo "<pubDate>".date('r', $row['time'])."</pubDate>\n";
	echo "<description>".htmlentities($row['desc'])."</description>\n";
	echo "</item>\n"; 

//Mon, 12 Sep 2005 18:37:00 GMT
}
echo "</channel>\n";



echo "</rss>\n";
?>